cmake_minimum_required(VERSION 3.10)
project(MyRdKafkaProject)

set(CMAKE_CXX_STANDARD 11)

# 设置 RdKafka 库的路径（如果库安装在非标准位置，需要调整）
find_package(PkgConfig REQUIRED)
pkg_check_modules(RDKAFKA REQUIRED rdkafka++)

# 包含路径和库路径
include_directories(${RDKAFKA_INCLUDE_DIRS})
link_directories(${RDKAFKA_LIBRARY_DIRS})

# 添加可执行文件
add_executable(producer producer.cpp)
add_executable(consumer consumer.cpp)

# 链接 rdkafka++ 库
target_link_libraries(producer ${RDKAFKA_LIBRARIES})
target_link_libraries(consumer ${RDKAFKA_LIBRARIES})
